package com.yunxi.poc.starbucks.common;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

@Component
public class BizConstant {
    public static final List<String> TARGET_STORES = Collections.unmodifiableList(Arrays.asList(
            "22206", "62980", "59924", "63978", "53534", "15400", "1257", "3844", "35002", "56618", "25868", "1334", "31509",
            "35012", "17559", "9178", "59643", "35027", "64955", "29779", "29998", "32412", "35041", "49878", "58457", "15671",
            "18222", "18338", "21112", "27660", "35014", "35032", "53495", "18932", "24893", "24980", "31850", "22217", "30950",
            "35010", "64739", "61775", "52229", "22753", "19016", "51480", "51344", "63655", "49754", "58459", "49753", "63799",
            "57115", "32093", "64640", "50456", "56404", "52102", "22251", "48076", "26728", "25749", "24347", "57097", "53338",
            "49025", "17395", "8086", "64957", "60704", "49860", "47173", "48573", "57403", "48437", "48138", "24991", "20884",
            "17676", "16308", "16357", "1648", "18064", "16672", "13179", "31857", "35813", "54183", "53518", "24348", "1336",
            "35803", "62264", "27017", "16966", "15616", "31281", "18052", "16313", "25561", "56667"
    ));

    public static final List<LocalDate> HOLIDAYS = Collections.unmodifiableList(Arrays.asList(
            LocalDate.of(2021, 4, 3),
            LocalDate.of(2021, 4, 4),
            LocalDate.of(2021, 4, 5),
            LocalDate.of(2021, 5, 1),
            LocalDate.of(2021, 5, 2),
            LocalDate.of(2021, 5, 3),
            LocalDate.of(2021, 5, 4),
            LocalDate.of(2021, 5, 5),
            LocalDate.of(2021, 6, 12),
            LocalDate.of(2021, 6, 13),
            LocalDate.of(2021, 6, 14)
    ));

    public static final List<String> REPORT_CATEGORY = Collections.unmodifiableList(Arrays.asList("Food", "Espresso", "Other Beverage", "Tea", "Frappuccino"));

    public static final long BATCH_NUM = 100;
    public static final long BATCH_THREADS_STORE = 10;

    public static Boolean STORES_LIMIT;

    /**
     * 惩罚项计算配置项
     */
    public static final int PUNISHMENT_MINUS_DAYS = 7;
    public static final int PUNISHMENT_MINUS_SECS = 24 * 60 * 60;
    public static final double PUNISHMENT_RATE_STANDARD = 0.5;
    public static double PUNISHMENT_LAMBDA2 = 1;

    /**
     * 客户满意度计算配置项
     */
    public static int SATISFIED_DEFAULT_DISTANCE;
    public static double SATISFIED_LAMBDA1;
    public static String SATISFIED_DISTANCE_TYPE;

    /**
     * 拥挤度计算配置项
     */
    public static int SCROWDED_WAIT_MINUTE;                                     // 等待时间 min
    public static int SCROWDED_EFFICIENCY_DAYS;                                 // 产能计算范围
    public static double SCROWDED_EFFICIENCY_DEFAULT_MIN;                       // 每分钟产能_最小值
    public static double SCROWDED_EFFICIENCY_DEFAULT_MAX;                       // 每分钟产能_最大值
    //    public static double SCROWDED_CAPACITY_DAYS;                           // 产能比较天数
    public static int SCROWDED_OPEN_TIME;                                       // 门店开门时间
    //    public static int SCROWDED_QUEUE_MIN;                                 // 队列时间 min
    public static String SCROWDED_WAITINGCOFFEE_TYPE;                           // 排队咖啡数量计算方式 -> queue|online
    public static int SCROWDED_CAPACITY_DAY_OF_MONTH_START;                      // 产能数据参考月份
    public static int SCROWDED_CAPACITY_DAY_OF_MONTH_END;                        // 产能数据参考月份开始日期
    public static int SCROWDED_CAPACITY_MONTH;                                   // 产能数据参考月份终止日期
    public static int SCROWDED_CAPACITY_YEAR;                                    // 产能数据参考年份
    public static String SCROWDED_QUEUE_MOCK_SALE_ITEM_CODE;                    // 模拟入库订单商品类型
    public static int SCROWDED_QUEUE_MOCK_SALE_ITEM_QUANTITY;                   // 模拟入库订单商品数量
    public static Boolean SCROWDED_QUEUE_SWITCH;                                // 模拟入库开关
    public static Boolean SCROWDED_CAPACITY_REFER_SWITCH;                        // 产能数据参考开关: on-表示参考某个固定的日期的产能, off-表示参考日期之前数据

    @Value("${biz.global.queue-insert-db-switch}")
    public void setScrowdedQueueSwitch(Boolean scrowdedQueueSwitch) {
        SCROWDED_QUEUE_SWITCH = scrowdedQueueSwitch;
    }

    @Value("${biz.scrowded.queue-mock-sale-item-code}")
    public void setScrowdedQueueMockSaleItemCode(String scrowdedQueueMockSaleItemCode) {
        SCROWDED_QUEUE_MOCK_SALE_ITEM_CODE = scrowdedQueueMockSaleItemCode;
    }

    @Value("${biz.scrowded.queue-mock-sale-item-quantity}")
    public void setScrowdedQueueMockSaleItemQuantity(int scrowdedQueueMockSaleItemQuantity) {
        SCROWDED_QUEUE_MOCK_SALE_ITEM_QUANTITY = scrowdedQueueMockSaleItemQuantity;
    }

    @Value("${biz.scrowded.capacity-day-of-month-start}")
    public void setScrowdedCapcityDayOfMonthStart(int scrowdedCapcityDayOfMonthStart) {
        SCROWDED_CAPACITY_DAY_OF_MONTH_START = scrowdedCapcityDayOfMonthStart;
    }

    @Value("${biz.scrowded.capacity-day-of-month-end}")
    public void setScrowdedCapcityDayOfMonthEnd(int scrowdedCapcityDayOfMonthEnd) {
        SCROWDED_CAPACITY_DAY_OF_MONTH_END = scrowdedCapcityDayOfMonthEnd;
    }

    @Value("${biz.scrowded.capacity-month}")
    public void setScrowdedCapcityMonth(int scrowdedCapcityMonth) {
        SCROWDED_CAPACITY_MONTH = scrowdedCapcityMonth;
    }

    @Value("${biz.scrowded.capacity-year}")
    public void setScrowdedCapcityYear(int scrowdedCapcityYear) {
        SCROWDED_CAPACITY_YEAR = scrowdedCapcityYear;
    }

    @Value("${biz.scrowded.waiting-coffee-type}")
    public void setScrowdedWaitingcoffeeType(String val) {
        SCROWDED_WAITINGCOFFEE_TYPE = val;
    }

    @Value("${biz.scrowded.default-efficiency-min}")
    public void setScrowdedEfficiencyDefault(double val) {
        SCROWDED_EFFICIENCY_DEFAULT_MIN = val;
    }

    @Value("${biz.scrowded.default-efficiency-max}")
    public void setScrowdedEfficiencyDefaultMax(double val) {
        SCROWDED_EFFICIENCY_DEFAULT_MAX = val;
    }

    @Value("${biz.scrowded.efficiency-days}")
    public void setScrowdedEfficiencyDays(int val) {
        SCROWDED_EFFICIENCY_DAYS = val;
    }

    @Value("${biz.scrowded.wait-mins}")
    public void setScrowdedWaitMinute(int val) {
        SCROWDED_WAIT_MINUTE = val;
    }

//    @Value("${biz.scrowded.queue-mins}")
//    public void setScrowdedQueueMin(int val) {
//        SCROWDED_QUEUE_MIN = val;
//    }

//    @Value("${biz.scrowded.capacity-days}")
//    public void setScrowdedCapcityDays(double val) {
//        SCROWDED_CAPACITY_DAYS = val;
//    }

    @Value("${biz.scrowded.open-time}")
    public void setScrowdedOpenTime(int val) {
        SCROWDED_OPEN_TIME = val;
    }

    @Value("${biz.satisfied.lambda}")
    public void setSatisfiedLambda1(double satisfiedLambda1) {
        SATISFIED_LAMBDA1 = satisfiedLambda1;
    }

    @Value("${biz.satisfied.default-distance}")
    public void setSatisfiedDefaultDistance(int satisfiedDefaultDistance) {
        SATISFIED_DEFAULT_DISTANCE = satisfiedDefaultDistance;
    }

    @Value("${biz.global.stores_limit}")
    public void setStoresLimit(Boolean storesLimit) {
        STORES_LIMIT = storesLimit;
    }

    @Value("${biz.satisfied.type}")
    public void setSatisfiedDistanceType(String satisfiedDistanceType) {
        SATISFIED_DISTANCE_TYPE = satisfiedDistanceType;
    }

    @Value("${biz.global.capacity-refer-to}")
    public void setScrowdedCapcityReferSwitch(Boolean scrowdedCapcityReferSwitch) {
        SCROWDED_CAPACITY_REFER_SWITCH = scrowdedCapcityReferSwitch;
    }
}